package com.epam.zhilko.entity;

import javax.persistence.*;

/**
 * Created with IntelliJ IDEA.
 * User: admin
 * Date: 11/26/13
 * Time: 9:53 AM
 * To change this template use File | Settings | File Templates.
 */

@Entity(name = "DEPARTMENT")
public class Department {


    private int id;
    private String name;
    private Employee headOfDepartment;

    @OneToOne (cascade = CascadeType.PERSIST)
    @JoinColumn(name = "HEAD_EMP_ID", referencedColumnName = "EMP_ID")
    public Employee getHeadOfDepartment() {
        return headOfDepartment;
    }

    public void setHeadOfDepartment(Employee headOfDepartment) {
        this.headOfDepartment = headOfDepartment;
    }

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "DEPT_ID")
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Column(name = "DEPT_NAME", nullable = true)
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }


}
